home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / STBKCLR.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  640 b   |  25 lines

  1. #include <graphics.h>
  2. #include <stdlib.h>
  3.  
  4. main()
  5. {
  6.    int graphdriver = DETECT, graphmode;
  7.    int maxcolor;
  8.  
  9. /* Initialize the graphics system */
  10.    initgraph(&graphdriver, &graphmode, "c:\\turboc");
  11. /* Now keep switching background colors randomly */
  12.    maxcolor = getmaxcolor();
  13. /* Initialize random number generator */
  14.    randomize();
  15.    outtextxy(10,20, "Demonstrating setbkcolor");
  16.    outtextxy(10,30, "Press any key to exit");
  17.    while (!kbhit))
  18.    {
  19.        setbkcolor(random(maxcolor));
  20.        delay(1000);  /* Pause for 1 second */
  21.    }
  22. /* Wait for 1 second, then exit */
  23.    delay(1000);
  24.    closegraph();
  25. }